import { Component, createRef } from "react";
import User from "./components/User/User";
class App extends Component {
  userRef = createRef();
  getUserRef = () => {
    const { current } = this.userRef;
    console.log(current);
    // console.log(this.refs.stringRef);
  };
  render() {
    return (
      <div>
        <User ref={this.userRef} name="洪奇奇" age="18" sex={"男"}></User>
        {/* <User ref="stringRef" name="洪奇奇" age="18" sex={"男"}></User> */}
        <button onClick={this.getUserRef}>获取user组件</button>
      </div>
    );
  }
}

export default App;
